{include file="public/toper"/}
<style>
    .layui-unselect{width: 190px;}
    .layui-form-select dl {width:190px;}
</style>
<div class="x-body">
    <form action="" method="post" class="layui-form" id="forms">
        <input type="hidden" name="bargain_id" value="{$list.bargain_id}">
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="x-red">*</span>选择商品</label>
            <div class="layui-input-inline">
                <select name="goods_id" lay-filter="goods">
                    {volist name="goods" id="vo"}
                    <option value="{$vo.goods_id}" {if condition = "$list.goods_id eq $vo.goods_id"}selected="selected"{/if}>{$vo.name}</option>
                    {/volist}
                </select>
            </div>
        </div>


        <div class="layui-form-item" id="g">
            <label class="layui-form-label"><span class="x-red">*</span>选择规格</label>
            <div class="layui-input-inline layui-form" id="guige" lay-filter="guig">

            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*规格名称，价格，库存</span>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
                <span class="x-red">*</span>被砍最高价
            </label>
            <div class="layui-input-inline">
                <input type="number" value="{$list.max_price}"  name="max_price" required="" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
                <span class="x-red">*</span>保底价
            </label>
            <div class="layui-input-inline">
                <input type="number" value="{$list.min_price}"  name="min_price" required="" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
                <span class="x-red">*</span>参与人数
            </label>
            <div class="layui-input-inline">
                <input type="number" value="{$list.join_count}" name="join_count" min="1" required="" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span>三位数
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
                <span class="x-red">*</span>砍价时间
            </label>
            <div class="layui-input-inline">
                <input type="text" id="start" value="{$list.start_time}" name="start_time" placeholder="开始日期" class="layui-input" readonly='readonly'>
            </div>
            <div class="layui-input-inline">
                <input type="text" id="settlement" value="{$list.end_time}" name="end_time" placeholder="结束日期"  class="layui-input" readonly='readonly'>
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span>一般间隔两个小时
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <button  class="layui-btn" lay-filter="formSubmit" lay-submit="">提交</button>
        </div>
    </form>
</div>

<script>
    layui.use(['form','laydate'], function(){
        $ = layui.jquery;
        var form = layui.form,layer = layui.layer;
        var laydate = layui.laydate;

        $("#g").css("display","none");

        form.on('select(goods)', function(data){
            $.ajax({
                type: "POST",
                data:{id:data.value},
                url:  "{:url('Goods/seckill')}",
                success: function(res) {
                    $('#guige').empty();
                    $("#g").css("display","block");
                    $("#guige").append(res);
                    form.render('select', 'guig');
                }
            });
        });



        laydate.render({
            elem: '#start'
            ,min:1
            ,type:'datetime'
            ,value: new Date({$list.start_time}*1000)
    });
        laydate.render({
            elem: '#settlement'
            ,min:1
            ,type:'datetime'
            ,value: new Date({$list.end_time}*1000)
    });

        var s = {$list.spec_item};
        $.ajax({
            type: "POST",
            data:{id:$("select  option:selected").val(),g:s},
            url:  "{:url('Goods/seckill')}",
            success: function(res) {
                $('#guige').empty();
                $("#g").css("display","block");
                $("#guige").append(res);
                form.render('select', 'guig');
            }
        });

    });
</script>
{include file="public/footer"/}